package com.da.landlord;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.googlecode.cswish.annotation.cm;
import com.ra.landlord.Building;
import com.ra.landlord.LandlordOwner;
import com.ra.landlord.LandlordOwnerUser;

/**
 * 业主合约
 * @author Peter.Z
 *
 */
@Entity
@Table(name="da_daowneragreement")
public class DaOwnerAgreement implements LandlordOwner{
	
	private Integer id;
	
	public static final Integer ISSUITE = 0;
	public static final Integer ISBUILDING = 1;
	
	@cm("合约有效性")
	private Boolean agreementState;
	
	@cm("合约编号")
	private String agreementNum;
	
	@cm("用于区分是分散式还是集中式的合约")
	private Integer type;
	
	@cm("所关联的suite或 building 的id")
	private Integer relateSuiteId;
	
	@cm("关联suite或building的名字")
	private String relateSuiteName;
	
	@cm("业主")
	private DaOwner owner;
	
	@cm("房东")
	private LandlordOwnerUser landlordUser;
	
	@cm("签约时间")
	private Date signDate;
	
	@cm("租期") //租多久  1年 2年 3年
	private String rentPeriod;
	
	@cm("收费周期类型 ")		
	private Integer rentCycleType;
	
	@cm("付款方式  押几")
	private Integer depositNum;
	
	@cm("付款方式  付几") //交租日期=起租日期+付几月  -提前多天
	private Integer payNum;
	
	@cm("起租日期")
	private Date rentBeginDate;

	@cm("到期日期")
	private Date rentEndDate;
	
	@cm("提前多少天 付款")
	private Integer advanceNum;
	
	@cm("押金") //租金*押几  可修改
	private BigDecimal deposit;

	@cm("租金  元/月")
	private BigDecimal rentPay;

	@cm("订金")
	private BigDecimal bookPay;
	
	@cm("备注")
	private String remark;
	
	@cm("下次交租时间")
	private Date nextPayDate;
	
	@cm("下次交租金额")
	private BigDecimal nextPayCount;
	
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(cascade = CascadeType.MERGE)
	public DaOwner getOwner() {
		return owner;
	}

	public void setOwner(DaOwner owner) {
		this.owner = owner;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getSignDate() {
		return signDate;
	}

	public void setSignDate(Date signDate) {
		this.signDate = signDate;
	}

	public String getRentPeriod() {
		return rentPeriod;
	}

	public void setRentPeriod(String rentPeriod) {
		this.rentPeriod = rentPeriod;
	}

	public Integer getRentCycleType() {
		return rentCycleType;
	}

	public void setRentCycleType(Integer rentCycleType) {
		this.rentCycleType = rentCycleType;
	}
	
	public Date getRentBeginDate() {
		return rentBeginDate;
	}

	public void setRentBeginDate(Date rentBeginDate) {
		this.rentBeginDate = rentBeginDate;
	}

	public Date getRentEndDate() {
		return rentEndDate;
	}

	public void setRentEndDate(Date rentEndDate) {
		this.rentEndDate = rentEndDate;
	}

	public BigDecimal getDeposit() {
		return deposit;
	}

	public void setDeposit(BigDecimal deposit) {
		this.deposit = deposit;
	}

	public BigDecimal getRentPay() {
		return rentPay;
	}

	public void setRentPay(BigDecimal rentPay) {
		this.rentPay = rentPay;
	}

	public BigDecimal getBookPay() {
		return bookPay;
	}

	public void setBookPay(BigDecimal bookPay) {
		this.bookPay = bookPay;
	}

	public Integer getDepositNum() {
		return depositNum;
	}

	public void setDepositNum(Integer depositNum) {
		this.depositNum = depositNum;
	}

	public Integer getPayNum() {
		return payNum;
	}

	public void setPayNum(Integer payNum) {
		this.payNum = payNum;
	}

	public Integer getAdvanceNum() {
		return advanceNum;
	}

	public void setAdvanceNum(Integer advanceNum) {
		this.advanceNum = advanceNum;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	
	public Boolean getAgreementState() {
		return agreementState;
	}

	public void setAgreementState(Boolean agreementState) {
		this.agreementState = agreementState;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	@Override
	public LandlordOwnerUser getLandlordUser() {
		return landlordUser;
	}

	@Override
	public void setLandlordUser(LandlordOwnerUser LandlordOwner) {
		this.landlordUser=LandlordOwner;
	}

	public String getAgreementNum() {
		return agreementNum;
	}

	public void setAgreementNum(String agreementNum) {
		this.agreementNum = agreementNum;
	}

	public Date getNextPayDate() {
		return nextPayDate;
	}

	public void setNextPayDate(Date nextPayDate) {
		this.nextPayDate = nextPayDate;
	}

	public BigDecimal getNextPayCount() {
		return nextPayCount;
	}

	public void setNextPayCount(BigDecimal nextPayCount) {
		this.nextPayCount = nextPayCount;
	}


	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getRelateSuiteId() {
		return relateSuiteId;
	}

	public void setRelateSuiteId(Integer relateSuiteId) {
		this.relateSuiteId = relateSuiteId;
	}

	public String getRelateSuiteName() {
		return relateSuiteName;
	}

	public void setRelateSuiteName(String relateSuiteName) {
		this.relateSuiteName = relateSuiteName;
	}
}
